import request from '@/config/axios'

// 产品 VO
export interface BomPlcRelVO {
  id: number // 编号
  bomId: number // 物料ID
  parentId: number // 父ID
  routeId: number // 工艺路线ID
  quantity: number // 数量
}

// 产品 API
export const BomPlcRelApi = {
  // 查询产品列表
  getBomPlcRelList: async (params) => {
    return await request.get({ url: `/opticore/bom-plc-rel/list`, params })
  },
  getBomPlcRelPage: async (params) => {
    return await request.get({ url: `/opticore/bom-plc-rel/page`, params })
  },

  // 查询产品详情
  getBomPlcRel: async (id: number) => {
    return await request.get({ url: `/opticore/bom-plc-rel/get?id=` + id })
  },

  // 新增产品
  createBomPlcRel: async (data: BomPlcRelVO) => {
    return await request.post({ url: `/opticore/bom-plc-rel/create`, data })
  },

  // 修改产品
  updateBomPlcRel: async (data: BomPlcRelVO) => {
    return await request.put({ url: `/opticore/bom-plc-rel/update`, data })
  },

  // 删除产品
  deleteBomPlcRel: async (id: number) => {
    return await request.delete({ url: `/opticore/bom-plc-rel/delete?id=` + id })
  },

  // 导出产品 Excel
  exportBomPlcRel: async (params) => {
    return await request.download({ url: `/opticore/bom-plc-rel/export-excel`, params })
  },
  // 获取导入模板
  importUserTemplate: async () => {
    return await request.download({ url: `/opticore/bom-plc-rel/get-import-template`})
  }

}
